home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 11 Learning / 08 Manslow / CWorld.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-01  |  1.5 KB  |  62 lines

  1. //Tanks
  2. //Copyright John Manslow
  3. //29/09/2001
  4.  
  5. #ifndef _CWorld_
  6. #define _CWorld_
  7.  
  8. class CTank;
  9. class CProjectile;
  10.  
  11. class ofstream;
  12.  
  13. class CWorld
  14. {
  15. public:
  16.     //Tell the world how big the terrain height array needs to be
  17.     CWorld(const unsigned long culTerrainResolution);
  18.     ~CWorld();
  19.  
  20.     //Fills the terrain height array with randomly generated terrain
  21.     void GenerateTerrain(void);
  22.  
  23.     //Called once per time step to check for events in the game world. Events are 
  24.     //projectile-tank collision, projectile-landscape collision and projectile leaving
  25.     //the world. Returns TRUE if an event occurs, FALSE otherwise.
  26.     BOOL TimeStep(void);
  27.  
  28.     //Initialises the world object. Generates terrain, places tanks, chooses starting 
  29.     //player, etc.
  30.     void Initialise(void);
  31.  
  32.     //The terrain height data array
  33.     long *plHeight;
  34.  
  35.     //The length of the terrain height array
  36.     unsigned long ulTerrainResolution;
  37.  
  38.     //The wind speed (constant during each player's turn)
  39.     double dWindSpeed;
  40.  
  41.     //A pointer to the array of (two) tanks in the world
  42.     CTank **ppPlayer;
  43.  
  44.     //A pointer to the projectile in the world. NULL if no projectile exists.
  45.     CProjectile *pProjectile;
  46.  
  47.     //A pointer to the file that we are saving example hit data to (in case we're
  48.     //generating training data).
  49.     ofstream *pHitData;
  50.  
  51.     //Which player is currently active. 0=human player's turn, 1=AI's turn.
  52.     int nActivePlayer;
  53.  
  54.     //The players' scores.
  55.     double dScore[2];
  56.  
  57.     unsigned long ulShotNumber;
  58.     double dAngularError;
  59.     double dLastAngularError;
  60. };
  61.  
  62. #endif